<template>
	<view class="sww-nav-bar-box">
		<!-- 去掉 height 传参时 就顺便看看 是不是 getSystemData() 里的conH 处理也要删掉 -->
		<!-- #ifndef H5 || APP-PLUS -->
		<u-navbar
			:z-index="10076"
			:is-back="isBack"
			:title="title"
			:background="{ background }"
			:height="vuex_system.contH || 0"
			:immersive="immersive"
			:border-bottom="borderBottom"
			:title-color="titleColor"
		></u-navbar>
		<!-- #endif -->
	</view>
</template>

<script>
import { mapState } from 'vuex';
export default {
	props: {
		title: {
			type: String,
			default: ''
		},
		background: {
			type: String,
			default: '#ffffff'
		},
		immersive: {
			type: Boolean,
			default: false
		},
		borderBottom: {
			type: Boolean,
			default: false
		},
		titleColor: {
			type: String,
			default: '#000000'
		},
		value: {
			type: Number,
			default: 0
		}
	},
	data() {
		return {
			isBack: false,
			contH: 44
		};
	},
	mounted() {
		//#ifdef H5 || APP-PLUS
		this.$nextTick(() => {
			// H5没生效....???
			uni.setNavigationBarColor({
				frontColor: this.titleColor || '#000000',
				backgroundColor: this.background,
				fail:(err)=>{
					console.log('err',err)
				}
			});
			uni.setNavigationBarTitle({ title: this.title });
		});
		//#endif
		//#ifndef H5 || APP-PLUS
		this.init();
		//#endif
	},
	computed: {
		...mapState(['vuex_system'])
	},
	methods: {
		init() {
			let pages = getCurrentPages();
			if (pages.length > 1) {
				this.isBack = true;
			}
			// this.$emit('input', this.$u.sys().statusBarHeight + 44)
		}
	}
};
</script>
